package com.zdy.demo2;

import java.util.HashSet;

/**
 * @author deyou
 * @version 1.0
 * @date 2021/5/19 15:37
 */

class Solution{
    public int findRepeatNumber(int[] nums){
        HashSet<Integer> set = new HashSet<>();

        for (int num : nums) {
            if(set.contains(num)){
                return num;
            }else {
                set.add(num);
            }
        }
        return -1;
    }
}

